UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3wNX5QBsgpOV0rurphnPRn9y5N3Y8HY8njh1uVO5r64=' 
WHERE 
  key_id = '4d6bd488f4afeced8735e3d5a231b9999be759c30d34907a81ab34b4a6fcb71b' 
  AND (
    token = '3wNX5QBsgpOV0rurphnPRn9y5N3Y8HY8njh1uVO5r64=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036