UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'alkd9/BbvC1m5jXS95u3div+987Aw7SXlWajPtibHpY='
WHERE
key_id = 'a09639df8bb68dd6efed0cfa040f722cb0b16ed4a04d8f9d7bcbea802c617d53'
AND (
token = 'alkd9/BbvC1m5jXS95u3div+987Aw7SXlWajPtibHpY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)