UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4qbgHI33LcIYTuEsZl5wlxbVnScSkka5QbAaznS7o5g=' 
WHERE 
  key_id = '154dcb9a223da6548886c8c0c154ac21708e2a85666ce616dc2a09fc0c66961a' 
  AND (
    token = '4qbgHI33LcIYTuEsZl5wlxbVnScSkka5QbAaznS7o5g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023