UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Zp1d0wJ6G3tt2PhJDre6//pILQ/izKy2I1/yHWI80yw=' 
WHERE 
  key_id = '96f2f5fc1d43947cb6de84253656682aec9dcf96fbb7c9fd4ebe0c729fa4ce16' 
  AND (
    token = 'Zp1d0wJ6G3tt2PhJDre6//pILQ/izKy2I1/yHWI80yw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00059