UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LTlDH2Fs7LbNDg+u0SrjJdUPnrA0tofTczRmw5Wae9I=' 
WHERE 
  key_id = '0dbdded35c0aeb07651cfc9c941461bcaa5b0babb0b51d145aa97b7a94368cb1' 
  AND (
    token = 'LTlDH2Fs7LbNDg+u0SrjJdUPnrA0tofTczRmw5Wae9I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00078