UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pb3Y1NSHy05ydeRxRHV16J24sPzWK/sthqUdNgRwN/Q=' 
WHERE 
  key_id = '6570dc2e11dbe022b8ecb5436b57676938d92e6fe340554856d32fc4accd7de8' 
  AND (
    token = 'pb3Y1NSHy05ydeRxRHV16J24sPzWK/sthqUdNgRwN/Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027