UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0douRhsvpDapBCQXKdvo7qLUUbjq2igHF3G8zliUyAs='
WHERE
key_id = '794383c75a9376e29f53744501c018a8051554804a353d247f0d71e66037b281'
AND (
token = '0douRhsvpDapBCQXKdvo7qLUUbjq2igHF3G8zliUyAs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)