UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zRP+AOxXgLSVqbLgIbcH7GuGtlwAnW+401oVD17KW5A=' 
WHERE 
  key_id = '3851d66ff0327503c6ea62e8365abea3717ec5cdd0b8b1de43bcb5fead40be3a' 
  AND (
    token = 'zRP+AOxXgLSVqbLgIbcH7GuGtlwAnW+401oVD17KW5A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049