UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'psXWfkOsg2+NMxW62wWKAmDmx1apbP5UVOlnaBzBIZk='
WHERE
key_id = 'b04d528c481f6064529fe60f49a888e558509041a8549f0f19159c28e7736939'
AND (
token = 'psXWfkOsg2+NMxW62wWKAmDmx1apbP5UVOlnaBzBIZk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)