UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hAITI8rPcCikLGLtKaW2QaHTbSx9njXb08eBDEcJtd4=' 
WHERE 
  key_id = '8baaf5cf5de9cc020e74ba89379d81ee22ad7070b9710a64ed5c1d38a6bf235f' 
  AND (
    token = 'hAITI8rPcCikLGLtKaW2QaHTbSx9njXb08eBDEcJtd4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031