UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6gTcxRO2ZuLXSbgj8PYGQnedb+9PF2+MG3yEyukhBCI=' 
WHERE 
  key_id = 'f9e06921170e005002664c9d17fea7ab5c3d30290218da75c7a09b5b26193d58' 
  AND (
    token = '6gTcxRO2ZuLXSbgj8PYGQnedb+9PF2+MG3yEyukhBCI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038