UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JDL0nKWl/5geJs8i6/47ulb5WJFlF2cgd7LidoH+gL4='
WHERE
key_id = '5f1daa8216b8ccbb081379acb36eadeb4036138d1847ca1283dc5dc02c879dd5'
AND (
token = 'JDL0nKWl/5geJs8i6/47ulb5WJFlF2cgd7LidoH+gL4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)