UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'M2CkOmWpdsO49yIy60b9X3v4tQxCzjPxMhb4Gc+7J6o='
WHERE
key_id = 'fea059eba4a1d8d382ca82b377a3992a4595cb185896d8016ebe10d61d8b42ca'
AND (
token = 'M2CkOmWpdsO49yIy60b9X3v4tQxCzjPxMhb4Gc+7J6o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)