UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tWyTrLQ1Q0jK7S/DKWTwcy3i3sAqMg3rkW7JdP6xFnQ='
WHERE
key_id = '04b3d41534fd11743d8dbd34d85709d69c2a6d569984f164dc237d11da2060ee'
AND (
token = 'tWyTrLQ1Q0jK7S/DKWTwcy3i3sAqMg3rkW7JdP6xFnQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)