UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wqzD/vMEHH0jHlMfN6aqhSEDvG/aiK+at2MjDzdbB8I='
WHERE
key_id = '027bea9310a46ab135a2aef72e68c3510cfe9dd0c02dcc796b30a13a5f407d7d'
AND (
token = 'wqzD/vMEHH0jHlMfN6aqhSEDvG/aiK+at2MjDzdbB8I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)