UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'A0DxbDKVccESLoitZOodb18pviMgZbMXhh9QEY8N+Ec=' 
WHERE 
  key_id = '2ecbcbb509e8f69e11974d09f7d70eeb0795f1a1d6dfcfdb905cd690739f4500' 
  AND (
    token = 'A0DxbDKVccESLoitZOodb18pviMgZbMXhh9QEY8N+Ec=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020