UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'm91z+FoSFdLW69QcuozngkNhQ/89ytZJPFw1eYczKn8=' 
WHERE 
  key_id = 'd3625b33895f214e6e00f5c0d23d4e8dd654b747480052ab43eb68434f8f6448' 
  AND (
    token = 'm91z+FoSFdLW69QcuozngkNhQ/89ytZJPFw1eYczKn8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023