UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jLcAxV7YrSA9bAVLgQW10x2T5jeEL7cL9UbbRdh3cfU=' 
WHERE 
  key_id = 'c0a4b05c313e0268932133994b29f5bca93a3663c6040b54ab52c3684d438010' 
  AND (
    token = 'jLcAxV7YrSA9bAVLgQW10x2T5jeEL7cL9UbbRdh3cfU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030