UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'f5ds5xyc7ST4p9RT8c8ubq/DoBbpBbfF6kE0zmK7noY='
WHERE
key_id = 'aa943c58a3818430d1524e6223309bb41c5c32bb90a0b2956d7fb78f2b39a81d'
AND (
token = 'f5ds5xyc7ST4p9RT8c8ubq/DoBbpBbfF6kE0zmK7noY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)