UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rgtX3GjQsrCR0asurPZkdm4NtJdSb/DO/YAHfC7mD+g=' 
WHERE 
  key_id = '80dcf49b1c09a0c7aa1b97285d1737041391ee15787630a523d92d5eefb18095' 
  AND (
    token = 'rgtX3GjQsrCR0asurPZkdm4NtJdSb/DO/YAHfC7mD+g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045