UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'obga9Vu1ACjd0faUl8UZy5LNyl8aSGYW40TpzVudVcc=' 
WHERE 
  key_id = '65ea55c8fb479d9b83759ab24113a2212b950bd18b28e104cf63e40c7e049456' 
  AND (
    token = 'obga9Vu1ACjd0faUl8UZy5LNyl8aSGYW40TpzVudVcc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00062