UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sws2bGo+hAw/2dDp6ftsSAA5wjtSuaBoXexoPeec4pk='
WHERE
key_id = 'e3713c547b0de230f0de188efa2013c87792c1a6a396e66c2779f0a107fddef1'
AND (
token = 'sws2bGo+hAw/2dDp6ftsSAA5wjtSuaBoXexoPeec4pk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)