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