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