UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ep0yNRC8HAQCpqjWqcxipprox1MrQ7xsfGqSu/ToD5Q=' 
WHERE 
  key_id = '45f9ddbcf38803d8ba0e7be7dc1a0437808b71f46b59504e229e0b0b8d13498f' 
  AND (
    token = 'Ep0yNRC8HAQCpqjWqcxipprox1MrQ7xsfGqSu/ToD5Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033