UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Vty2gXH81OHaQlnFmEARZ0RpQv6T+I3TBhweTpNZtM0='
WHERE
key_id = '7138dc7d1957b8252c4da3c9d5959f0e869598e436077120d6f41c1e63e8c7bb'
AND (
token = 'Vty2gXH81OHaQlnFmEARZ0RpQv6T+I3TBhweTpNZtM0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)