UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YMrpFENnZjRGcyu1UdVC3Lsd4mCIkHXB6mqYA09VL0U='
WHERE
key_id = 'b9fa6b998f8cc2cdfd263a300ce4ce938bad42860c11630d3ee92bb1d919a467'
AND (
token = 'YMrpFENnZjRGcyu1UdVC3Lsd4mCIkHXB6mqYA09VL0U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)