UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'DyP6ZCmTHvxCY/vl/3HC830LNYfdzunWdrrAC+d0LgA='
WHERE
key_id = 'b7246e8ed73813be41ac6635e79cb41b05c8b4e7872b8d16c4fb4290281a15fe'
AND (
token = 'DyP6ZCmTHvxCY/vl/3HC830LNYfdzunWdrrAC+d0LgA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)