UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BpmmwdTjU946vwp71sK8AVQi+2vzUv+30Wh1i3P7hds=' 
WHERE 
  key_id = 'dfbfcccecccace89657aef15c0b0b6f01e3fda51bf8df9065f352d31eddba354' 
  AND (
    token = 'BpmmwdTjU946vwp71sK8AVQi+2vzUv+30Wh1i3P7hds=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040