UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iSZGA9ZlVpCCAioNBzkzw8nas4ecX1Dq1izDTMOqecA=' 
WHERE 
  key_id = '858cd1825ac9fdc05b18ff1a08d234c9c79fda484ac0aa061fb83e1a7295442b' 
  AND (
    token = 'iSZGA9ZlVpCCAioNBzkzw8nas4ecX1Dq1izDTMOqecA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029