UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Bht2Tk4CEVT+GnW3wSw/NuhHVnlWj40PkseSV4IkKZQ=' 
WHERE 
  key_id = '05ab26d6f6d4ec153419999c6753754b6c81dffffc9a1a1709a5458f61933b6d' 
  AND (
    token = 'Bht2Tk4CEVT+GnW3wSw/NuhHVnlWj40PkseSV4IkKZQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036