UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'DMZZYnxf5MzsU14uzKAO8foIGxAyfgX55APN0F9Lurc='
WHERE
key_id = '516a591644a07a2de2209c4c1744ab6f0f1b6ce6b6395cc304cc82939cb5013b'
AND (
token = 'DMZZYnxf5MzsU14uzKAO8foIGxAyfgX55APN0F9Lurc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)