UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BKfr4VT8MYEtKa8tEM4BB74nlYyy+Sw4LWkxda6hKSo=' 
WHERE 
  key_id = '604bc4947c56a3ab40330d79a0202759cd8d92e38e4f721fd6d256e7d0070530' 
  AND (
    token = 'BKfr4VT8MYEtKa8tEM4BB74nlYyy+Sw4LWkxda6hKSo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044