UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Ysg7WDnu32Vb1rAOrxOPiGm4ra8TLX5/2+4Nao2qJfo='
WHERE
key_id = 'e132eac53c4c268f13ed217bf4e47588cedb09b04f53df9f8626d63232399932'
AND (
token = 'Ysg7WDnu32Vb1rAOrxOPiGm4ra8TLX5/2+4Nao2qJfo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)