UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4/tRJWBimF6/mzPbQN8wLymsqI2MocdbBr543BCgPyc='
WHERE
key_id = '316fabf8c736b82bc28ab076a69b5880e941511e0bc6fa1347cb2872564585d8'
AND (
token = '4/tRJWBimF6/mzPbQN8wLymsqI2MocdbBr543BCgPyc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)