UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YxS1J5DAHDNM4nlymMBl8Jbg+Gwf/Jbe3OZaGVRZ6vE=' 
WHERE 
  key_id = 'e27f3e94c70031792f3830bf59f4141493edf1c420adf3401f7648edbfff6722' 
  AND (
    token = 'YxS1J5DAHDNM4nlymMBl8Jbg+Gwf/Jbe3OZaGVRZ6vE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027