UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'P/Pj4Mo4f85mLIZ2GBH61rv9iCnDCLNxSECk62a1cmM='
WHERE
key_id = 'd271eba5b7cb538af475955e6e4a2a8c434cc4cd5d109567359016c8de116327'
AND (
token = 'P/Pj4Mo4f85mLIZ2GBH61rv9iCnDCLNxSECk62a1cmM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)