UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'U+Yq1nQB5P9kco6oAT9zmEWtAY1tNajJqy3FJHl3y+8=' 
WHERE 
  key_id = '48b5a504b0809c23e75747fc943245c9daa21dd74628bb30349dacad8535fafb' 
  AND (
    token = 'U+Yq1nQB5P9kco6oAT9zmEWtAY1tNajJqy3FJHl3y+8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030