UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'WYjh94XnK8yDQAh2uS0X131cbXORVe+i4e3/NfXIgTY='
WHERE
key_id = '402732d19035d37d920129174065a8de8901fec27f9813b4b739e7bf6dad523f'
AND (
token = 'WYjh94XnK8yDQAh2uS0X131cbXORVe+i4e3/NfXIgTY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)