UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'a899mSoDx57bKVEMMdh8tkI88Zu6y051vIv2jh6czCA='
WHERE
key_id = '6a6315ed8dbd6780c301b6fdc57c27f3d4bde2cd3e5c6f1d14c8ce279037cf6b'
AND (
token = 'a899mSoDx57bKVEMMdh8tkI88Zu6y051vIv2jh6czCA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)