UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'yN2ykPnM0Z5hWiOhtsnaVig3kReY0uh4EZ9UihkB1rk='
WHERE
key_id = '7a65cb0eca96890fc4122a92824adda84fa01a4196a4ba17bd8000258e578ddb'
AND (
token = 'yN2ykPnM0Z5hWiOhtsnaVig3kReY0uh4EZ9UihkB1rk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)