UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'yScl+4P+meMjXhT4eK3/883Lh1cSJbHY+rrSsd6nXu0='
WHERE
key_id = '40da799e9e826bc3eff3414bb546d8cfc20510a0028e0e3e9df62b9327ef8714'
AND (
token = 'yScl+4P+meMjXhT4eK3/883Lh1cSJbHY+rrSsd6nXu0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)