UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qcXoxPzzMvMlAq/fT+EpA7xBuRJdvfGjyCJ1bHZ9AAM=' 
WHERE 
  key_id = '1caf6ee404b49911d6a4ae9bb503f39fb0187b3f73357a62f49f6f7782633741' 
  AND (
    token = 'qcXoxPzzMvMlAq/fT+EpA7xBuRJdvfGjyCJ1bHZ9AAM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048