UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oyAoL4T+aQ8neATpgifRakHIFMhz0v/X1owMXgeZA0E='
WHERE
key_id = '90f12f98ad7ab3287f68260481a75a64a76bbe5ea65436548460d37611e1907c'
AND (
token = 'oyAoL4T+aQ8neATpgifRakHIFMhz0v/X1owMXgeZA0E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)