UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'GHbkcnnxgtr241qkKZK6g/s89lZmdnfGc27zLS+GFWU='
WHERE
key_id = 'f03a6ccb6d7e2189371513762daca88a55bacdc5e9a2579d48be010e45b61d12'
AND (
token = 'GHbkcnnxgtr241qkKZK6g/s89lZmdnfGc27zLS+GFWU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)