UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ITYqQe/C6+nRlJ9GM/1xp2rxMOPSrVD0FJt2wLEtqCI=' 
WHERE 
  key_id = 'c849894793ce72d3c8974d67db9b57e29b3c741066d4f4cd93ce27be67ca2b2d' 
  AND (
    token = 'ITYqQe/C6+nRlJ9GM/1xp2rxMOPSrVD0FJt2wLEtqCI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00015