UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ssWp9sFC8V7l1CpNB8Va2B010+IWKylthQl2Ir0baC8='
WHERE
key_id = '16d005d974ee6303e2d569b3ef0a69afe9d956286c5d3cf75f17779bb6e47702'
AND (
token = 'ssWp9sFC8V7l1CpNB8Va2B010+IWKylthQl2Ir0baC8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)