UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AJ+X8KOuSCMbWIjSpL9FVBB1I3p0h4F9HdoXPgLvQt8=' 
WHERE 
  key_id = '6a0176c643c93b5359980a73f44e2cb00498c211c3f4a2cd9140ca8e0c78b9c1' 
  AND (
    token = 'AJ+X8KOuSCMbWIjSpL9FVBB1I3p0h4F9HdoXPgLvQt8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038