UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'd1hhGKhfQ0YhqhGYjc4daLt3Fr5DbbulcTMBlXsQZD8=' 
WHERE 
  key_id = 'ddb9593ab4857a5e0757f22047a1ca2a60618e1680173a4b5426319eb80f86ab' 
  AND (
    token = 'd1hhGKhfQ0YhqhGYjc4daLt3Fr5DbbulcTMBlXsQZD8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027