UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XfCDL/dxowNWPiE1pIzFq4AniEO1nr9j2E1UjhcgEXk='
WHERE
key_id = 'd7857d2ad52bfeb7caa71c0b240506830ca1e4bdcbdd72a4d69bb577cb223774'
AND (
token = 'XfCDL/dxowNWPiE1pIzFq4AniEO1nr9j2E1UjhcgEXk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)