UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BH7lYzBXEbdzdfrjgGld0g3MnATyRqXkZ1gO7RVORx4=' 
WHERE 
  key_id = '13aa60b14625d9b2a0c93f1c1ed83aacd2eb047952fbb5e13af7a7c629a5353c' 
  AND (
    token = 'BH7lYzBXEbdzdfrjgGld0g3MnATyRqXkZ1gO7RVORx4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042