UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oCE6qiXq0gJCrD44rMHwrA2duNeESOVM7gwKiPtwl8U=' 
WHERE 
  key_id = 'f24993e1b5793c74621a0b1b0673c577733c96106d29b5b0b1601baf9292a238' 
  AND (
    token = 'oCE6qiXq0gJCrD44rMHwrA2duNeESOVM7gwKiPtwl8U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039