UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1nQJh35s+3DQtv0zhP5KoYbAQtHil8FEhpUApBQpTBk='
WHERE
key_id = 'f0f178bcf793dfab883f569e775736fdd5967ffa7c2f3e2c0739d3315a574cbd'
AND (
token = '1nQJh35s+3DQtv0zhP5KoYbAQtHil8FEhpUApBQpTBk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)