UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NxvWxTIdEss2TCuKgMjL44HBZdVAzeh+yusIlWx0Z/8='
WHERE
key_id = 'cd0e530b67c6d164a352d4aafc22d0c44b7eba3291d5d643a84c91da83a133c1'
AND (
token = 'NxvWxTIdEss2TCuKgMjL44HBZdVAzeh+yusIlWx0Z/8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)