UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'LKdA3lkDvjId/KW3Qt0b7rqUrjd+nry5pKcK2pVwx3c='
WHERE
key_id = 'a3b39334fe5362cb6b6938b4197f692e1f7d409e324489b23c93b5e6634c62e3'
AND (
token = 'LKdA3lkDvjId/KW3Qt0b7rqUrjd+nry5pKcK2pVwx3c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)