UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lQKXL/sjczzl4yv5QC1+/+ZHoNmaHeMA8eFDGZkxyK8=' 
WHERE 
  key_id = 'ba7edbfe79a83049425a0370bb5296786b3dca934324709f275981fe395f1e51' 
  AND (
    token = 'lQKXL/sjczzl4yv5QC1+/+ZHoNmaHeMA8eFDGZkxyK8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024