UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'PPCCK0rQEX9iTYSzrAgmybdLWu1IZyV3zvQyXDOGMjI='
WHERE
key_id = 'c1d195faad68ef7411dfe8ffda37377d4ef3be387ee270d78fdd923171ebe4a9'
AND (
token = 'PPCCK0rQEX9iTYSzrAgmybdLWu1IZyV3zvQyXDOGMjI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)