UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5bHbdYH55/qnRfnzsA5xhuvyegH4TXwKnfnRH8kab3Q='
WHERE
key_id = '310ec5698ecb73b39695a8c356547c1df0ee00380334c4d5a8d4c19a2150610c'
AND (
token = '5bHbdYH55/qnRfnzsA5xhuvyegH4TXwKnfnRH8kab3Q='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)