UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'yFaNBSgXSwD3usdlkKQEp7zHWEtCWqlApStzq4Ak73s='
WHERE
key_id = 'b946ec262995196967cd531f1cf4d57f3f52e5f94bc7d1a229b976360027b2de'
AND (
token = 'yFaNBSgXSwD3usdlkKQEp7zHWEtCWqlApStzq4Ak73s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)